package com.chance.cc.crawler.development.command.trigger.domain.tianya;

import com.chance.cc.crawler.core.CrawlerJob;
import com.chance.cc.crawler.development.command.job.domain.tianya.TYCommonScript;
import com.chance.cc.crawler.development.command.job.domain.tianya.realtime.TYBBSRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.job.domain.tianya.trace.TYBBSTraceCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.job.domain.weibo.api.realtime.WeiboKeywordsRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.trigger.CommonCrawlerTestSchedulerTrigger;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;

/**
 * @author lt
 * @version 1.0
 * @date 2021-03-24 11:01:31
 * @email okprog@sina.com
 */
public class TYBBSCrawlerTrigger extends CommonCrawlerTestSchedulerTrigger {

    public static void main(String[] args) {

        publishTYBBSRealtimeCrawlerScheduleTriggerInfo();

        publishTYBBSTraceCrawlerScheduleTriggerInfo();

    }

    /**
     * 发布天涯论坛板块2小时采集实时任务trigger info

     */
    public static void publishTYBBSRealtimeCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = TYBBSRealtimeCrawlerSchedulerJob.crawlerScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                TYCommonScript.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/2 * * ?",
                "天涯论坛板块实时采集任务执行，每两小时执行一次"
        );
    }

    /**
     * 发布天涯论坛板块采集回溯任务trigger info

     */
    public static void publishTYBBSTraceCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = TYBBSTraceCrawlerSchedulerJob.crawlerScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                TYCommonScript.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0 * * ?",
                "天涯论坛板块24小时回溯采集任务执行，每天执行一次"
        );
    }
}
